<?php /* 程序侠版权所有 技术论坛支持: bbs.chengxuxia.com QQ: 573907419 正版授权防止出现漏洞后门
-- enphp : https://git.oschina.net/mz/mzphp2
 */

namespace app\common\controller;
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(E_ALL ^ E_NOTICE);
use think\Db;
use app\common\controller\Base;

class Mobile extends Base
{
    protected function _initialize()
    {
        parent::_initialize();
    }

    protected function filterGoods($var_1, $var_2, $var_3 = "new", $var_4 = 0, $var_5 = '')
    {
        if (empty($var_2)) {
            return !1;
        }
        $var_7 = input('p', 1);
        $var_8 = $this->_list($var_1, $var_2, $var_3, $var_4, $var_5, '', 20, $var_7, !0);
        $var_9 = $var_8['total'];
        $var_10 = $var_8['list'];
        if ((count($var_10) < 20) && $var_5) {
            $var_11 = get_taobao_coupon($var_5, 2);
            $var_10 = !empty($var_10) && is_array($var_10) ? array_merge($var_10, $var_11) : $var_11;
            $var_9 = $var_9 ? (empty($var_10) ? ($var_9 + 1) : $var_9) : 1;
        }
        if (!$var_9) {
            $var_12['status'] = 100;
            $var_12['info'] = '没有符合要求的商品';
        } else {
            $var_13 = ceil($var_9 / 20);
            if ($var_7 <= $var_13) {
                $var_14 = [];
                foreach ($var_10 as $var_15) {
                    $var_15['goodsUrl'] = url('Goods/index', ['id' => $var_15['goods_id']]);
                    if ($var_15['coupon_url']) {
                        $var_15['goodsUrl'] .= '?couponUrl=' . urlencode($var_15['coupon_url']);
                    }
                    $var_14[] = $var_15;
                }
                $var_12['status'] = 200;
                $var_12['goodsList'] = $var_14;
                $var_12['goodsBgimg'] = get_config('WEB_SITE_URL') . get_config('WEB_GOODS_BGIMG');
                $var_12['total'] = $var_9;
                $var_12['pageTotal'] = $var_13;
            } else {
                $var_12['status'] = 300;
                $var_12['info'] = '～我是有底线的哦！～';
            }
        }
        $var_12['p'] = $var_7;
        $this->showJson($var_12);
    }

    protected function updateData($var_16, $var_17, $var_18 = 'Goods')
    {
        if (Db::name($var_18)->where($var_16)->update($var_17)) {
            return !0;
        } else {
            return !1;
        }
    }

    protected function updateField($var_19, $var_20, $var_21, $var_22 = 'Goods')
    {
        if (Db::name($var_22)->where($var_21)->setField($var_19, $var_20)) {
            return !0;
        } else {
            return !1;
        }
    }

    protected function showJson($var_23)
    {
        header('Content-Type:text/html; charset=utf-8');
        die(json_encode($var_23, !0));
    }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;